var sidebarSublistMenuOpenned = false;
var formLoginOpenned = false;
var menuSublistOpenned = false;

$(document).ready(function() {
	/** SideBar Mobile Controll **/
	$('#sidebar-mobile-link-menu').click(function() {
		if (!sidebarSublistMenuOpenned) {
			$('.sidebar-mobile-sublist').show(function() {
				sidebarSublistMenuOpenned = true;
			});
		} else {
			$('.sidebar-mobile-sublist').hide(function() {
				sidebarSublistMenuOpenned = false;
			});
		}
	});

	/** Login Mobile Controll **/
	$('#sidebar-mobile-link-login').click(function() {
		if (!formLoginOpenned) {
			$('.header-mobile-form-login').show(function() {
				formLoginOpenned = true;
			});
		} else {
			$('.header-mobile-form-login').hide(function() {
				formLoginOpenned = false;
			});
		}
	});

	/** Sidebar Menu Controll **/
	$('li a.has-sublist').click(function() {
		if (!menuSublistOpenned) {
			$(this).parents().find('.sublist').show(function() {
				menuSublistOpenned = true;
			});
		} else {
			$(this).parents().find('.sublist').hide(function() {
				menuSublistOpenned = false;
			});
		}
	});

});

/** Popup Products Controll **/
function openPopup() {
	/** Scroll to top **/
	$('html, body').animate({ scrollTop: 0 }, 'slow');
	$('#mask').fadeIn(function(){
		$('#popup-product').fadeIn(function(){
			document.body.style.overflow='hidden';
		});
	});
}

function closePopup() {
	$('#popup-product').fadeOut(function(){
		$('#mask').fadeOut(function(){
			document.body.style.overflow='auto';
		});
	});
}